#pragma once
#include "BaseInc.h"


template<typename T>
class C_API CSizeTmpl
{
public :
	CSizeTmpl() : m_width(0), m_height(0) {}
	CSizeTmpl(T  w, T  h) : m_width(w), m_height(h) {}

	const T & GetWidth() const { return m_width;}
	VOID SetWidth(const T & width) { m_width = width;}

	const T & GetHeight() const { return m_height;}
	VOID SetHeight(const T &  height) { m_height = height;}

	T GetArea() const { return m_width * m_height;}

	CSizeTmpl & operator = (const CSizeTmpl & size)
	{
		m_width = size.m_width;
		m_height = size.m_height;
		return *this;
	}
	CSizeTmpl & operator *= (const T & rate)
	{
		m_width *= rate;
		m_height *= rate;
		return *this;
	}

	BOOL operator == (const CSizeTmpl & size) const
	{
		return m_width == size.m_width && m_height == size.m_height;
	}
	BOOL operator != (const CSizeTmpl & size) const
	{
		return m_width != size.m_width || m_height != size.m_height;
	}

	VOID Set(const T & width, const T & height)
	{
		m_width = width; m_height = height;
	}
	BOOL Equal(const T & width, const T & height) const
	{
		return m_width == width && m_height == height;
	}

	BOOL operator < (const CSizeTmpl & another) const
	{
		return m_width < another.m_width && m_height < another.m_height;
	}

	BOOL operator > (const CSizeTmpl & another) const
	{
		return m_width > another.m_width && m_height > another.m_height;
	}
	BOOL operator <= (const CSizeTmpl & another) const
	{
		return m_width <= another.m_width && m_height <= another.m_height;
	}

	BOOL operator >= (const CSizeTmpl & another) const
	{
		return m_width >= another.m_width && m_height >= another.m_height;
	}
	CSizeTmpl operator + (const CSizeTmpl & another) const
	{
		return CSizeTmpl(m_width + another.m_width, m_height + another.m_height);
	}
	CSizeTmpl operator += (const CSizeTmpl & another)
	{
		m_width += another.m_width;
		m_height += another.m_height;
		return *this;
	}
	CSizeTmpl operator * (T rate) const
	{
		return CSizeTmpl(m_width * rate, m_height * rate);
	}

private :
	T m_width, m_height;

public :
	GETTER_SETTER(const T &, Width, GetWidth, SetWidth);
	GETTER_SETTER(const T &, Height, GetHeight, SetHeight);
	GETTER_ONLY(T, Area, GetArea);

};



